import java.io.*;
import java.util.*;

public class Main {
    private static HashMap<String, Integer> stateTransMap = new HashMap<>();
    private static Integer initState = 0;
    private static HashSet<String> operator = new HashSet<>();
    // 添加状态转换信息到 HashMap
    public static String[] getInput(File fileName){
        try(BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(fileName)));){
            StringBuilder text = new StringBuilder();
            String l = "";
            while((l=br.readLine())!=null)
                text.append(l);
            String[] strs = text.toString().replaceAll("\\s*","").split(";");
            return strs;
        } catch (Exception e) {
            return null;
        }
    }
    public static String[] getInput(){
        System.out.println("请输入......");
        Scanner input = new Scanner(System.in);
        StringBuilder text = new StringBuilder();
        String l = "";
        while((l=input.nextLine())!=null){
            if (l.equals("exit")) {
                break; // 输入 'exit' 时退出循环
            }
            text.append(l);
        }
        String[] strs = text.toString().replaceAll("\\s*","").split(";");
        input.close();
        return strs;
    }
    public static void init(){
        stateTransMap.put("0,a", 1);
        stateTransMap.put("0,b", 2);
        stateTransMap.put("0,<", 1);
        stateTransMap.put("0,>", 1);
        stateTransMap.put("0,==", 1);
        stateTransMap.put("0,!=", 1);
        stateTransMap.put("0,<=", 1);
        stateTransMap.put("0,>=", 1);
        stateTransMap.put("0,1", 1);

        stateTransMap.put("1,a", 1);
        stateTransMap.put("1,b", 2);
        stateTransMap.put("1,<", -1);
        stateTransMap.put("1,>", -1);
        stateTransMap.put("1,==", -1);
        stateTransMap.put("1,!=", -1);
        stateTransMap.put("1,<=", -1);
        stateTransMap.put("1,>=", -1);
        stateTransMap.put("1,1", -1);

        stateTransMap.put("2,a", 1);
        stateTransMap.put("2,b", 3);
        stateTransMap.put("2,<", -1);
        stateTransMap.put("2,>", -1);
        stateTransMap.put("2,==", -1);
        stateTransMap.put("2,!=", -1);
        stateTransMap.put("2,<=", -1);
        stateTransMap.put("2,>=", -1);
        stateTransMap.put("2,1", -1);

        stateTransMap.put("3,a", 1);
        stateTransMap.put("3,b", 3);
        stateTransMap.put("3,<", 4);
        stateTransMap.put("3,>", 4);
        stateTransMap.put("3,==", 4);
        stateTransMap.put("3,!=", 4);
        stateTransMap.put("3,<=", 4);
        stateTransMap.put("3,>=", 4);
        stateTransMap.put("3,1", -1);

        stateTransMap.put("4,a", -1);
        stateTransMap.put("4,b", -1);
        stateTransMap.put("4,<", -1);
        stateTransMap.put("4,>", -1);
        stateTransMap.put("4,==", -1);
        stateTransMap.put("4,!=", -1);
        stateTransMap.put("4,<=", -1);
        stateTransMap.put("4,>=", -1);
        stateTransMap.put("4,1", 10);

        stateTransMap.put("10,a", -1);
        stateTransMap.put("10,b", -1);
        stateTransMap.put("10,<", -1);
        stateTransMap.put("10,>", -1);
        stateTransMap.put("10,==", -1);
        stateTransMap.put("10,!=", -1);
        stateTransMap.put("10,<=", -1);
        stateTransMap.put("10,>=", -1);
        stateTransMap.put("10,1", -1);

        operator.add("<");
        operator.add("<=");
        operator.add(">");
        operator.add(">=");
        operator.add("!=");
        operator.add("==");
        operator.add("a");
        operator.add("b");
        operator.add("1");
    }
    public static boolean move(Integer state, String word){
        int i,j;
        for(i = 0;i < word.length();){
            String current = state+",";
            String op = "";
            for(j = 2;j > 0;j--){
                int strIndex = i;
                int endIndex = word.length() < i+j ? word.length() : i+j;
                String temp = word.substring(strIndex,endIndex);
                if(operator.contains(temp))
                {
                    op = temp;
                    i += temp.length();
                    break;
                }
            }
            if(op != ""){
                current += op;//构成完整的key
                state = stateTransMap.get(current);
            }
            else
                return false;
            if(state == -1)
                return false;
        }
        //必须遍历完整个词法单元，正好判定到终态成功才能说此单元成功匹配了
        if(state == 10)
            return true;
        else
            return false;
    }
    public static void main(String[] args){
        initState=0;
        init();
        String[] undetermined = getInput();
        /*
        a>=1;ab==1;aa>1;b<1;
        abb>=1;abbb==1;aabb>1;bb<1;
         */
        for(String word : undetermined){
            if(move(initState, word))
                System.out.println("Yes");
            else
                System.out.println("No");
        }
    }
}
